<?php


namespace App\Service;


class Push
{
    private $title;
    private $message;
    private $payload;
    private $body;


    /**
     * @param $title
     */
    public function setTitle( $title ) {
        $this->title = $title;
        return $this;
    }

    /**
     * @param $message
     */
    public function setMessage( $message ) {
        $this->message = $message;
        return $this;
    }


    /**
     * @param $payload
     */
    public function setPayload( $payload)
    {
        $this->payload = $payload;
        return $this;
    }


    /**
     * @param $body
     */
    public function setData( $body )
    {
        $this->body = $body;
        return $this;
    }


    /**
     * @return array
     */
    public function getPush()
    {
        $response                    = array();
        $response['data']['title']   = $this->title;
        $response['data']['body']    = $this->body;
        $response['data']['sound']   = 'default';
//        $response['data']['icon']      = 'default';
//        $response['data']['android_channel_id']     = '';   // 安卓指定
//        $response['data']['click_action']     = '';   // 是否可点击
        $response['data']['message'] = $this->message;
        $response['data']['payload'] = $this->payload;
        $response['data']['date']    = date( 'Y-m-d H:i:s' );

        return $response;
    }
}